package com.datalayer.testclasses;

import com.datalayer.annotations.Attribute;
import com.datalayer.annotations.Constraint;
import com.datalayer.annotations.Direction;
import com.datalayer.annotations.Entity;

/**
 * Created with IntelliJ IDEA.
 * User: Georgiana.Scarlat
 * Date: 7/25/12
 * Time: 2:52 PM
 */
@SuppressWarnings("UnusedDeclaration")
@Entity(tableName = "ANGAJAT_FUNCTIE")
public class AngajatFunctie {
    private int idAngajat, idFunctie;
    private String numeAngajat;

    public AngajatFunctie() {
    }

    public AngajatFunctie(int idAngajat, int idFunctie, String numeAngajat) {
        this.idAngajat = idAngajat;
        this.idFunctie = idFunctie;
        this.numeAngajat = numeAngajat;
    }

    @Direction("get")
    @Constraint(constraintName = "primary key")
    @Attribute(fieldName = "idAngajat", attributeName = "id_angajat", type = "int")
    public int getIdAngajat() {
        return idAngajat;
    }

    @Direction("set")
    @Constraint(constraintName = "primary key")
    @Attribute(fieldName = "idAngajat", attributeName = "id_angajat", type = "int")
    public void setIdAngajat(int idAngajat) {
        this.idAngajat = idAngajat;
    }

    @Direction("get")
    @Constraint(constraintName = "primary key")
    @Attribute(fieldName = "idFunctie", attributeName = "id_functie", type = "int")
    public int getIdFunctie() {
        return idFunctie;
    }

    @Direction("set")
    @Constraint(constraintName = "primary key")
    @Attribute(fieldName = "idFunctie", attributeName = "id_functie", type = "int")
    public void setIdFunctie(int idFunctie) {
        this.idFunctie = idFunctie;
    }

    @Direction("get")
    @Attribute(fieldName = "numeAngajat", attributeName = "nume_angajat", type = "varchar(20)")
    public String getNumeAngajat() {
        return numeAngajat;
    }

    @Direction("set")
    @Attribute(fieldName = "numeAngajat", attributeName = "nume_angajat", type = "varchar(20)")
    public void setNumeAngajat(String numeAngajat) {
        this.numeAngajat = numeAngajat;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AngajatFunctie that = (AngajatFunctie) o;

        return idAngajat == that.idAngajat && idFunctie == that.idFunctie && !(numeAngajat != null ? !numeAngajat.equals(that.numeAngajat) : that.numeAngajat != null);

    }

    @Override
    public int hashCode() {
        int result = idAngajat;
        result = 31 * result + idFunctie;
        result = 31 * result + (numeAngajat != null ? numeAngajat.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "AngajatFunctie{" +
                "idAngajat=" + idAngajat +
                ", idFunctie=" + idFunctie +
                ", numeAngajat='" + numeAngajat + '\'' +
                '}';
    }
}
